//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#if _MSC_VER > 1000
#pragma once
#endif

#if !defined(__CKTFSDIRECTORY_H__)
#define __CKTFSDIRECTORY_H__

#define _NO_CKTFSDIRECTORY_CLASSOBJECT_
#include "_CKtfsDirectory.h"
#include "depend.h"

class CKtfsDirectory : public _CKtfsDirectory
{
public:
    CARAPI Sync();

    CARAPI GetType(
        /* [out] */ FileType * pType);

    CARAPI GetAccessTime(
        /* [out] */ Int32 * pTime);

    CARAPI SetAccessTime(
        /* [in] */ Int32 time);

    CARAPI GetModificationTime(
        /* [out] */ Int32 * pTime);

    CARAPI SetModificationTime(
        /* [in] */ Int32 time);

    CARAPI GetCreateTime(
        /* [out] */ Int32 * pTime);

    CARAPI CheckAccessMode(
        /* [in] */ FileAccessMode mode);

    CARAPI GetAccessMode(
        /* [out] */ FileAccessMode * pMode);

    CARAPI SetAccessMode(
        /* [in]  */ FileAccessMode mode);

    CARAPI GetShareMode(
        /* [out] */ FileShareMode *pMode);

    CARAPI SetShareMode(
        /* [in] */ FileShareMode mode);

    CARAPI Lookup(
        /* [in] */ WString wstrPath,
        /* [out] */ IBasicFile * * piBasicFile);

    CARAPI CreateFile(
        /* [in] */ WString wstrPath,
        /* [in] */ FileAccessMode cmode,
        /* [in] */ Boolean bExclusive,
        /* [out] */ IBasicFile * * piBasicFile);

    CARAPI DeleteFile(
        /* [in] */ WString wstrPath);

    CARAPI Rename(
        /* [in] */ WString wstrSrcPath,
        /* [in] */ IBasicDirectory * pNewDir,
        /* [in] */ WString wstrDestPath);

    CARAPI CreateDirectory(
        /* [in] */ WString wstrPath,
        /* [in] */ FileAccessMode mode);

    CARAPI DeleteDirectory(
        /* [in] */ WString wstrPath);

    CARAPI GetDirEntries(
        /* [out] */ IWStringEnumerator * * piEntryNameEnumerator);

    CARAPI CombineName(
         /* [in] */  WString name,
         /* [out] */ WChar *fullname);

    CARAPI AddFileMonitor(
        /* [out] */ IEvent **ppEvent);

    CARAPI RemoveFileMonitor(
        /* [in] */ IEvent *pEvent);

    ~CKtfsDirectory();

    CKtfsDirectory();

    CKtfsDirectory(
        /* [in] */ WString wszDir,
        /* [in] */ FileAccessMode faMode = FileAccessMode_ReadWrite);

    void *operator new(size_t size) { return ::operator new(size); }

private:
    WString m_wstrCurDir;
    FileAccessMode m_eFMode;
    Int32 m_iCreateTime;
    Int32 m_iAccessTime;
    Int32 m_iModificationTime;

    CARAPI GetNameStat(
         /* [in] */  WChar *wcsName,
         /* [out] */ Boolean *bIsExist,
         /* [out] */ Boolean *bIsDir);
};

#endif //!(__CBASICDIRECTORY_H__)
